/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn2;

import javax.swing.*;

/**
 *
 * @author Mathias
 */
class DownloadTask extends SwingWorker<String, Object> {

       Overlay myOverlay;
       String filename;
       java.util.ArrayList rps;
       long size;       
       JProgressBar pBar;
       ViewPeer vp;
       String md5;

       public DownloadTask (Overlay o, String filename, java.util.ArrayList rps, long size, JProgressBar pBar, ViewPeer vp, String md5) {
           this.myOverlay = o;
           this.filename = filename;
           this.rps = rps;
           this.size = size;           
           this.pBar = pBar;
           this.vp = vp;
           this.md5 = md5;
       }

       @Override
       public String doInBackground() {

           this.myOverlay.download(filename, rps, size, pBar, vp, md5);

           return "";
       }

       @Override
       protected void done() {
           try {
               System.out.println("done");
           } catch (Exception ignore) {
           }
       }
   }